<?php
/**
 *      
 * 
 *  @author          Edmandie Samonte        (edmandie.samonte@gmail.com)
 *  @copyright       2011 
 * 
 */
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Dashboard</title>
        <script type="text/javascript" src="<?php echo load_js('jquery.min.js');?>" ></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $('#filter').keyup(function(){
                    rx = new RegExp($('#filter').val().toUpperCase(),'g');
                    $data = $('.employee-data');
                    $data.each(function(){
                        if(!rx.test($(this).html().toUpperCase())){
                            $(this).parent().hide('medium');
                        }else{
                            $(this).parent().show('medium');
                        }
                        
                    });
                });
            });
        </script>
        <style type="text/css" media="screen">
            @import url(<?php echo load_css('common.css');?>);
            @import url(<?php echo load_css('header.css');?>);
            @import url(<?php echo load_css('dashboard.css');?>);
            @import url(<?php echo load_css('logged_in.css');?>);
        </style>
    </head>
    <body>
        <div class="main-container">
            <?php require_once 'header.php';?>
            <span class="page-title">Dashboard</span>
            <div class="post-head">
                <table >
                    <tr>
                        <td>
                            <img src="<?php echo load_image('profile_pic/'. $user->ePictureURL); ?>" title="" alt="" height="125"/>
                        </td>
                        <td style="width:20px"></td>
                        <td>
                            <span class="user_name"><?php echo $user->eFirstName . " " .$user->eMiddleName . " " . $user->eLastName; ?></span><br/>
                            <span class="user_position"><?php echo $position;?></span><br/>
                            <span class="user_id">ID# <?php echo str_pad($user->eID,4,"0",STR_PAD_LEFT);?></span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="clearfix">
                <div id="right">
                    <div class="navigation">
                    <div class="pane-title">Navigation</div>
                        <div class="controls">
                            <a href="<?php echo current_url();?>" class="selected">Dashboard</a><br/>
                            <a href="<?php echo site_url('employee/add'); ?>">Add Employee</a><br/>
                            <a href="<?php echo site_url('dashboard/logout'); ?>">Logout</a>
                        </div>
                    </div>
                    
                </div>
                <div id="left">
                    <div class="pane-title">Attendance</div>
                    <div id="filter-box">
                        <span>Filter</span>
                        <input type="text" id="filter"/>
                    </div>
                    <div id="list">
                        <table style="width: 95%" >
                            <?php foreach($employees as $employee):?>
                            <?php 
                                    $p;
                                    foreach($position_list as $pos){
                                        if($pos->posID === $employee->ePosition){
                                            $p = $pos;
                                        }
                                    }
                                    if($p->isAdmin === 'T'){
                                        continue;
                                    }
                            ?>
                            <tr class="employee">
                                <td>
                                    <img src="<?php echo load_image('profile_pic/' . $employee->ePictureURL);?>" alt="" title="" height="75"/>
                                </td>
                                <td class="employee-data">
                                    <a href="<?php echo site_url('employee/profile/' .$employee->eID ) ;?>">
                                        <span class="name"><?php echo $employee->eFirstName . " " . $employee->eMiddleName . " " . $employee->eLastName;?></span><br/>
                                        <span class="id">ID# <?php echo str_pad($employee->eID,4,"0",STR_PAD_LEFT);?>,</span>
                                        <span class="position">
                                            <?php echo $p->posName;?>
                                        </span>
                                    </a>
                                </td>
                            </tr>
                            <?php endforeach; ?>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
